package com.aiyige.page.my.message.adapter;

import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.aiyige.R;
import com.aiyige.page.my.message.ContactPage;
import com.aiyige.utils.BlankFragment;
import com.aiyige.utils.StringUtils;
import com.netease.nim.uikit.business.recent.RecentContactsFragment;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

public class CommunicateAdapter extends FragmentStatePagerAdapter {
    List<String> pageTitleList;
    List<Fragment> fragmentList;

    public CommunicateAdapter(FragmentManager fm) {
        super(fm);
        pageTitleList = Arrays.asList(StringUtils.getString(R.string.message), StringUtils.getString(R.string.contact));
        fragmentList = new LinkedList<>();
        fragmentList.add(RecentContactsFragment.newInstance());
        fragmentList.add(ContactPage.newInstance());
    }

    @Override
    public Fragment getItem(int position) {
        return fragmentList.get(position);
    }

    @Override
    public int getCount() {
        return fragmentList.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return pageTitleList.get(position);
    }
}
